var myApp = {
	setSelect:function(){
		$(".flip,.icon-guanbi").click(function(){
		    $(".panel-me").slideToggle("slow");
		});
	},
	verticalSelect:function(){
		$(".verticalSelect-tit").click(function(){
		    $(".verticalSelect-con").slideToggle("slow");
		});
	},
	// a标签点击虚线
	aBlur:function(){
		$("a").bind("focus",function() {
			if(this.blur) {this.blur()};
		});
	},
	verticalNav:function(el, multiple){
		Accordion = function(el, multiple) {
		this.el = el || {};
		this.multiple = multiple || false;

		var links = this.el.find('.link');
		links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown)
		}

		Accordion.prototype.dropdown = function(e) {
			var $el = e.data.el;
				$this = $(this),
				$next = $this.next();

			$next.slideToggle();
			$this.parent().toggleClass('open');

			if (!e.data.multiple) {
				$el.find('.submenu').not($next).slideUp().parent().removeClass('open');
			};
		}	

		var accordion = new Accordion($('#accordion'), false);
	},
	verticalNav1:function(){
		$(".submenu").css({
			"display":"block"
		})
	},
	btnNav:function(){
		$(".btn-nav").click(function(){
	      	$(".verticalNav,.header-nav-left").toggle("slow");
	      	setTimeout(function(){
	      		$(".posNav").toggleClass("on");
	      		$(".content-container").toggleClass("active");
	      		$(".header-nav .header-nav-right").toggleClass("active");
	      	},300);
	    });
	},
	modelBtn:function(){
		$(".one-model").click(function(){
	      	$(".header-nav,.verticalNav,.posNav,.accordion,.submenu,.first-ul").addClass("active");
	      	$(".header-nav-right").addClass("on");
	      	$(".header-nav-left").css({
	      		"background":"#263238"
	      	});
	      	$(".change").css({
	      		"color":"#fff"
	      	});
	      	
	    });
	    $(".model").click(function(){
	      	$(".header-nav,.verticalNav,.posNav,.accordion,.submenu,.first-ul").removeClass("active");
	      	$(".header-nav-right").removeClass("on");
	      	$(".header-nav-left").css({
	      		"background":"#fff"
	      	});
	      	$(".change").css({
	      		"color":"#222"
	      	});
	    });
	    $(".panel dl").mousemove(function(){
			$(this).addClass("active")
		}).mouseleave(function(){
			$(this).removeClass("active")
		});

	},
	customScroll:function(){
    	// $(".verticalNav").mCustomScrollbar();
		$("#verticalNav").niceScroll({
			cursorborder:"",
			cursorwidth:"5px",
			cursorcolor:"#CCC"
		});
	},
	wC:function(){
		$(".submenu").addClass('on');
		$(".toggle-switch").click(function(){	
			if($(this).is('.icon-kaiguan1')){
				// myApp.verticalNav();
				$(this).removeClass('icon-kaiguan1').addClass('icon-kaiguanguan-copy');
				$(".submenu").removeClass('on');
			}else{
				// myApp.verticalNav1();
				$(this).removeClass('icon-kaiguanguan-copy').addClass('icon-kaiguan1');
				$(".submenu").addClass('on');
			}
		});
	},
	init: function() {
		myApp.aBlur();
		myApp.setSelect();
		myApp.verticalSelect();
		myApp.btnNav();
		myApp.modelBtn();
		myApp.customScroll();
		myApp.verticalNav1();
		myApp.wC();
	}
}
$(document).ready(function(){
  myApp.init();
});